﻿using System.Collections.Generic;
using FluentParser.Expressions;

namespace FluentParser
{
    /// <summary>
    /// The base type of context to be sent to a grammar's
    /// parsing operation.
    /// </summary>
    public class GrammarContext
    {
        public GrammarContext(string text)
        {
            Text = text;
            Errors = new List<ParsingException>();
        }

        /// <summary>
        /// The text to be parsed.
        /// </summary>
        public string Text { get; set; }

        /// <summary>
        /// Determines if a recoverable error should automatically break
        /// even if it has the potential to recover. This permet to discover multiple
        /// errors during a single pass.
        /// </summary>
        public bool AllowToRecover { get; set; }

        /// <summary>
        /// List of errors encountered during a parsing session.
        /// </summary>
        public List<ParsingException> Errors { get; private set; }
    }

}